import { defineStore } from 'pinia'
import { useUserStore } from '../user'


export const useChatStore = defineStore('chat', {
  state: () => {
  return {
    chatList: [],
    currentSessionId: null,
    currentChat: null,
    messageList:[]
  }
},
  actions: {
    async getSessionList() {
      const userStore = useUserStore()
      const data = await window.ipcRenderer.invoke('get-session-list' , userStore.uid)
      this.chatList = data.list
    },
    clear() {
      this.chatList = []
      this.currentSessionId = null
      this.messageList = []
      this.currentChat = null
    }
  },
getters: {},
})
